home *** CD-ROM | disk | FTP | other *** search
- Program DemoInput;
-
- { Purpose....... Demonstrates the use of the following units: win, screen,
- strings, datetime, cursor and input.
- Comments...... None
- Author........ Thayne Breetzke
- Date.......... 22 March 1994 }
-
- Uses
- Crt,
- Dos,
- Windows,
- Screen,
- Strings,
- DateTime,
- Cursor,
- Input;
-
- Var
- InputString: String;
- Key : Char;
- Extended,
- HelpOn : Boolean;
- CState : CStateRec;
-
- {$F+}
- Procedure UpdateProc(Var Key: Char; Var Extended: Boolean; UpdateVar: Word);
-
- Var
- Hour,
- Min,
- Sec,
- Sec100 : Word;
-
- Begin
- GetTime(Hour,Min,Sec,Sec100);
- WriteWinXY(72,25,TimeStr(Hour,Min,Sec,0,':'),0+7*16);
- If (Key = #59) and not HelpOn then
- Begin
- HelpOn := True;
- SaveCursor(InsertKey,CState);
- CursorOff;
- OpenWindow(7,8,74,21,' Help ',' Press Esc to close this help window ',DoubleFrame,15+4*16,15+4*16,True);
- WriteMem(9,10,'No help available');
- GetKey(Key,Extended,[#27],[],True,True,UpdateProc,0);
- CloseWindow;
- RestoreCursor(CState);
- Key := #0;
- HelpOn := False
- end
- end;
- {$F-}
-
- Begin
- TextAttr := 7;
- CursorOff;
- InputString := '';
- HelpOn := False;
- ClearArea(1,1,80,25,7,'▒');
- DrawBox(4,2,77,4,'','',DoubleFrame,15+1*16,14+1*16,True);
- WriteMem(5,3,Center('The "Complete" Borland Turbo Pascal 6.0 Toolbox',72));
- WriteWinXY(1,25,CopyChar(' ',80),112);
- WriteWinXY(2,25,'F1',4+7*16);
- WriteWinXY(5,25,'Help',0+7*16);
- OpenWindow(11,10,70,17,'',' Press Ctrl-Enter to continue ',SingleFrame,15+7*16,15+7*16,True);
- WriteWinXY(19,12,'Using GetKey routine to scan for keypresses',0+7*16);
- WriteWinXY(15,14,'Last key pressed: ',0+7*16);
- WriteWinXY(15,15,'Was it extended?: ',0+7*16);
- Repeat
- GetKey(Key,Extended,[#0..#255],[#0..#255],True,True,UpdateProc,0);
- WriteWinXY(33,14,Key+' (#'+NumToStr(Ord(Key),0,0,False)+') ',0+7*16);
- If Extended then
- WriteWinXY(33,15,'Yes',0+7*16)
- else
- WriteWinXY(33,15,'No ',0+7*16)
- until Key = #10;
- ClearArea(12,11,69,16,0+7*16,' ');
- WriteWinXY(20,12,'Using ReadString routine to read a string',0+7*16);
- WriteWinXY(15,14,'Enter a string:',0+7*16);
- ReadString(InputString,31,14,50,25,[#32..#126],False,[#13,#10,#27],[#45],
- Key,Extended,True,False,112,UpdateProc,0);
- CloseWindow;
- CursorOn(False);
- ClrScr;
- Writeln('As entered: '+InputString);
- Writeln('Upper case: '+Upper(InputString));
- Writeln('Lower case: '+Lower(InputString))
- end.